package com.cqcis.uip.base.ds;

import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;

public class MonitorConnection implements Connection {
	private Connection inner;
	private Map<Integer, String> busyTasks;

	public MonitorConnection(Connection inner, Map<Integer, String> busyTasks) {
		this.inner = inner;
		this.busyTasks = busyTasks;
	}

	public void clearWarnings() throws SQLException {
		this.inner.clearWarnings();
	}

	public void close() throws SQLException {
		this.busyTasks.remove(inner.hashCode());
		this.inner.close();
	}

	public void commit() throws SQLException {
		this.inner.commit();
	}

	public Statement createStatement() throws SQLException {
		return this.inner.createStatement();
	}

	public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
		return this.inner.createStatement(resultSetType, resultSetConcurrency);
	}

	public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
			throws SQLException {
		return this.inner.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	public boolean getAutoCommit() throws SQLException {
		return this.inner.getAutoCommit();
	}

	public String getCatalog() throws SQLException {
		return this.inner.getCatalog();
	}

	public int getHoldability() throws SQLException {
		return this.inner.getHoldability();
	}

	public DatabaseMetaData getMetaData() throws SQLException {
		return this.inner.getMetaData();
	}

	public int getTransactionIsolation() throws SQLException {
		return this.inner.getTransactionIsolation();
	}

	public Map<String, Class<?>> getTypeMap() throws SQLException {
		return this.inner.getTypeMap();
	}

	public SQLWarning getWarnings() throws SQLException {
		return this.inner.getWarnings();
	}

	public boolean isClosed() throws SQLException {
		return this.inner.isClosed();
	}

	public boolean isReadOnly() throws SQLException {
		return this.inner.isReadOnly();
	}

	public String nativeSQL(String sql) throws SQLException {
		return this.inner.nativeSQL(sql);
	}

	public CallableStatement prepareCall(String sql) throws SQLException {
		return this.inner.prepareCall(sql);
	}

	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
		return this.inner.prepareCall(sql, resultSetType, resultSetConcurrency);
	}

	public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
			int resultSetHoldability) throws SQLException {
		return this.inner.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	public PreparedStatement prepareStatement(String sql) throws SQLException {
		return this.inner.prepareStatement(sql);
	}

	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
		return this.inner.prepareStatement(sql, autoGeneratedKeys);
	}

	public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
		return this.inner.prepareStatement(sql, columnIndexes);
	}

	public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
		return this.inner.prepareStatement(sql, columnNames);
	}

	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
			throws SQLException {
		return this.inner.prepareStatement(sql, resultSetType, resultSetConcurrency);
	}

	public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
			int resultSetHoldability) throws SQLException {		
		return this.inner.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
	}

	public void releaseSavepoint(Savepoint savepoint) throws SQLException {
		this.inner.releaseSavepoint(savepoint);
	}

	public void rollback() throws SQLException {
		this.inner.rollback();
	}

	public void rollback(Savepoint savepoint) throws SQLException {
		this.inner.rollback(savepoint);
	}

	public void setAutoCommit(boolean autoCommit) throws SQLException {
		this.inner.setAutoCommit(autoCommit);
	}

	public void setCatalog(String catalog) throws SQLException {
		this.inner.setCatalog(catalog);
	}

	public void setHoldability(int holdability) throws SQLException {
		this.inner.setHoldability(holdability);
	}

	public void setReadOnly(boolean readOnly) throws SQLException {
		this.inner.setReadOnly(readOnly);
	}

	public Savepoint setSavepoint() throws SQLException {
		return this.inner.setSavepoint();
	}

	public Savepoint setSavepoint(String name) throws SQLException {
		return this.inner.setSavepoint(name);
	}

	public void setTransactionIsolation(int level) throws SQLException {
		this.inner.setTransactionIsolation(level);
	}

	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
		this.inner.setTypeMap(map);
	}

	public boolean isWrapperFor(Class<?> arg0) throws SQLException {
		// TODO Auto-generated method stub
		return false;
	}

	public <T> T unwrap(Class<T> arg0) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Blob createBlob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Clob createClob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public NClob createNClob() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public SQLXML createSQLXML() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Struct createStruct(String arg0, Object[] arg1) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public Properties getClientInfo() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public String getClientInfo(String arg0) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean isValid(int arg0) throws SQLException {
		// TODO Auto-generated method stub
		return false;
	}

	public void setClientInfo(Properties arg0) throws SQLClientInfoException {
		// TODO Auto-generated method stub
		
	}

	public void setClientInfo(String arg0, String arg1)
			throws SQLClientInfoException {
		// TODO Auto-generated method stub
		
	}
}
